﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ATM.Core.DomainObject;
using ATM.Core.Infrastructure.DependencyInjection;
using ATM.Core.Infrastructure.Logging;
using ATM.Repository;
using log4net.altconf;

namespace ATM.Core.Infra.BootStrapper
{
    public static class DependencyBootStrapper
    {
        //public static void RegisterMappers()
        //{
        //    //SimpleObjectMapperContainer.RegisterMapper(new SimpleObjectMapper<Administrator, AdministratorDTO>());
        //    //SimpleObjectMapperContainer.RegisterMapper(new SimpleObjectMapper<Location, LocationDTO>());

        //    //SimpleObjectMapperContainer.RegisterMapper(new SimpleObjectMapper<Staff, StaffDTO>()
        //    //                                            .Explicit((staff, staffDTO) => staffDTO.LocationId = staff.Location.Id)
        //    //                                            .Explicit((staff, staffDTO) => staffDTO.LocationDescription = staff.Location.Value)
        //    //                                            .Explicit((staff, staffDTO) => staffDTO.Photo.Data = staff.Photo));

        //    //SimpleObjectMapperContainer.RegisterMapper(new SimpleObjectMapper<StaffDTO, Staff>()
        //    //                                            .Explicit((staffDTO, staff) =>
        //    //                                            {
        //    //                                                if ((staffDTO.Photo.SaveOption == PhotoSaveOption.Update) && (staffDTO.Photo.Data != null))
        //    //                                                    staff.Photo = staffDTO.Photo.Data;
        //    //                                            })
        //    //                                            .Explicit((staffDTO, staff) => staff.Location.Id = staffDTO.LocationId));

        //    //SimpleObjectMapperContainer.RegisterMapper(new SimpleObjectMapper<DomainObjectValidationResult, NotificationDTO>()
        //    //                                            .Explicit((domain, dto) =>
        //    //                                            {
        //    //                                                foreach (var item in domain.Results)
        //    //                                                    dto.AddError(item.ValidationId, item.Message);
        //    //                                            }));
        //}


        public static void ConfigureDependencies()
        {
            IoC.AddComponent<ILog, Log4NetLog>("Log");

            //Entitys
            IoC.AddComponent<IPerfil, Perfil>("Perfil");
            IoC.AddComponent<IProject, Project>("Project");
            IoC.AddComponent<IStory, Story>("Project");
            IoC.AddComponent<IStorySituation, StorySituation>("StorySituation");
            IoC.AddComponent<IUser, UserATM>("UserATM");
            IoC.AddComponent<IUserProject, UserProject>("UserProject");

            //Services

            //Repositorys
        }

        //public static void ConfigureLogging()
        //{
        //    DslConfigurator.BaseDirectory = AppDomain.CurrentDomain.BaseDirectory;
        //    DslConfigurator.Configure("logging-config.boo");
        //}
    }
}